const App = getApp();
Component({
  options: {
    addGlobalClass: true,
  },
  data:{
    token:wx.getStorageSync('token'),
    phone:wx.getStorageSync('phone')
  },
  /**
   * 组件的属性列表
   * 用于组件自定义设置
   */
  properties: {
    itemIndex: String,
    itemStyle: Object,
    params: Object,
    dataList: Object
  },
  /**
   * 组件的方法列表
   * 更新属性和数据的方法与更新页面数据的方法类似
   */
  methods: {
    /**
     * 跳转到指定页面
     */
    navigationTo: function (e) {
        // App.navigationTo(e.currentTarget.dataset.url+'&text=' + e.currentTarget.dataset.text);
        App.navigationTo(e.currentTarget.dataset.url);
    },

    hospital(){
      wx.switchTab({
        url: '/pages/organPage/detailsPage/detailsPage',
      })
    },
    doctor(){
      wx.navigateTo({
        url: '/pages/doctorPage/detailsPage/detailsPage',
      })
    },
    baoG(){
      wx.navigateTo({
        url: '/pages/user/report/report',
      })
    },
    getPhoneNumber (e) {
      let code = e.detail.code
      if(e.detail.errMsg == 'getPhoneNumber:ok') {
        App._get('user.phone/getUserPhone', {code}, function(result) {
          if(result.code == 1) {
            wx.setStorageSync('phone',result.data.phone)
            wx.navigateTo({
              url: '/pages/user/report/report',
            })
          }
        });
      }
    },
    onLogin() {
      wx.navigateTo({
        url: '/pages/login/login',
      });
    },
    shangC(){
      wx.navigateTo({
        url: '/pages/custom/index?page_id=10003',
        // url: '/pages/category/index',
      })
    }
  }
})